<?php

namespace App\Exceptions;


use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Handlers\Error;

class ErrorHandler extends Error{

    public function __construct($displayErrorDetails = false)
    {
        parent::__construct($displayErrorDetails);
    }

    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, \Exception $exception)
    {
        if ($exception instanceof ModelNotFoundException) {
            return (new NotFound())($request, $response);
        }
        return parent::__invoke($request, $response, $exception); // TODO: Change the autogenerated stub
    }
}